﻿<UserControl 
        x:Class="DiscoveryLogic.UI.Layouts.ContentScreens.MortgageCalculator"
        xmlns="http://schemas.microsoft.com/client/2007"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:DiscoveryLogic.UI.Layouts.Controls"
        xmlns:con="clr-namespace:DiscoveryLogic.UI.Layouts.Converters"
        xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <UserControl.Resources>
        <sys:String x:Key="Res_LeftBlock">Total Amount Remaining:  {0,10}{2}Interest Rate:{1,32}</sys:String> <!-- {2} is a new line-->
        <sys:String x:Key="Res_MiddleBlock">Next Payment Date:  {0,12}{2}Next Payment Amount:        {1}</sys:String> <!-- {2} is a new line-->
        <sys:String x:Key="Res_RightBlock">Amount Past Due: {0}</sys:String>
        <sys:String x:Key="Res_BalanceLegend">Balance ({0})</sys:String>
        
        <con:CurrencyConverter x:Key="currConverter" />
    </UserControl.Resources>
    
    
    <Canvas
        x:Name="MortgageCalculatorCanvas"
        Width="824"
        Height="668"       
       >
        <Canvas.Resources>
            <Storyboard x:Name="test">
                <DoubleAnimation Storyboard.TargetName="Center"
                        Storyboard.TargetProperty="(Canvas.Left)"
                        By="5"
                        Duration="00:00:01"
                         FillBehavior="HoldEnd"
                        />
            </Storyboard>

        </Canvas.Resources>

        <TextBlock Width="200" Height="26.524" TextAlignment="Center" TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Foreground="#FF1D62AF" Canvas.Left="10" Canvas.Top="130">
            <Run Text="You are saving:" FontFamily="Trebuchet MS" FontSize="21" Foreground="#FF1D62AF"/>
        </TextBlock>
        
        <TextBlock x:Name="SavingsAmount" Text="{Binding SavingsAmount, Converter={StaticResource currConverter}}" TextAlignment="Center" Width="200" Height="55" TextWrapping="Wrap" 
                   FontSize="32" FontWeight="Bold" Foreground="#FF458A67" Canvas.Left="10" Canvas.Top="160" FontFamily="Trebuchet MS" />
        
        <!-- Current Value is what will be changed by the slider. -->
        <controls:CylinderSlider Canvas.Top="150" Canvas.Left="-60"
            MaxPayment="{Binding MaxPayment}" 
            MinPayment="{Binding Account.MinimumPayment}" 
            CurrentValue="{Binding Account.NextPaymentAmount, Mode=TwoWay}" 
            LowValue="{Binding Account.NextPaymentInterest}" 
            CurrentValueDescription="Principal"
            LowValueDescription="Interest"
            Title="Monthly Payment"

            MinPaymentFormat="Min Payment {0:C}"
            LowValueFormat="Interest {0:C}"
            ZeroValueFormat="{}{0:C}"
            MaxValueFormat="{}{0:C}"
            CurrentValueFormat="{}{0:C}"
                >                 
            <!-- You can even style the cylinders like so...
            ThumbBrush="{StaticResource brush1}"
            TopCylinderRoofBrush="{StaticResource brush2}"
            TopCylinderBodyBrush="{StaticResource brush3}"
            BottomCylinderRoofBrush="{StaticResource brush4}"
            BottomCylinderBodyBrush="{StaticResource brush5}"
            -->
                               
            
        </controls:CylinderSlider>
        
        <!-- complete date is what will be changed by the slider. -->
        <controls:GraphSlider x:Name="_graphSlider" Canvas.Top="140.373" Canvas.Left="192.0"
            Title="Mortgage Timeline" 
            BalanceLegend="Balance {0}"
            CompleteDescriptionFormat="Complete\n{0:MMMM yyyy}"
            CompleteDate="{Binding Account.ProjectedPaymentCompleteDate, Mode=TwoWay}"
            StartDate="{Binding Account.PaymentSchedule.StartDate}"
            EndDate="{Binding Account.PaymentSchedule.EndDate}"
            TotalPayments="{Binding Account.PaymentSchedule.TotalPayments}"
            NextPaymentInterest="{Binding Account.NextPaymentInterest}"/>


        <!--Header Title-->
        <TextBlock Canvas.Left="207" Canvas.Top="21.932" Height="30.608" Style="{StaticResource MainPageHeading}" Text="Mortgage" />
        
        <!--Underline-->
        <Path Stretch="Fill" Stroke="{StaticResource MainHeadingDividerBrush}" StrokeEndLineCap="Round" StrokeStartLineCap="Round" StrokeThickness="2" Canvas.ZIndex="10" Canvas.Left="207" Canvas.Top="51.54" Height="4" Data="M240,70.873 L679.25619,70.873" Width="700"/>


        <!--Text Areas-->
        <!--TextBlock Canvas.Left="82" Canvas.Top="0" Width="127" Height="22" TextWrapping="Wrap" FontFamily="Trebuchet MS">
    <Run >Monthly Payment (^)</Run>
  </TextBlock-->
        <Canvas Canvas.Left="299.15" Canvas.Top="400">
            <TextBlock Canvas.Left="0" Canvas.Top ="0" Height="30.884" Text="Understand Your Mortgage" Style="{StaticResource InfoTipHeading}"/>
    <TextBlock Canvas.Left="17.665" Canvas.Top="30"  Height="122" Style="{StaticResource InfoTipBody}" Width="400">
      <Run Text="Drag the blue circles to scroll through your mortgage timeline and see how your payment structure changes over time, or to adjust your monthly payment amount and see the effect on the duration of your mortgage." ></Run>
      <LineBreak/>
      <LineBreak/>
      <Run Text="To see how different mortgage plans stack up, click 'Compare Mortgages' above." ></Run>
    </TextBlock>
  </Canvas>

        <Canvas Canvas.Left="225" Canvas.Top="91.805">
            <TextBlock Canvas.Left="220" Canvas.Top="0" Height="37.627" Style="{StaticResource DefaultBodyText}"
                       Width="216" Text="Total Amount Remaining:  ^^^^^&#xd;&#xa;Interest Rate:                       xx%" x:Name="MiddleGroup"/>
            <TextBlock Height="37.627" Style="{StaticResource DefaultBodyText}" Canvas.Left="0" Canvas.Top="0" Width="216" Text="Next Payment Date:  29 Nov 2007&#xd;&#xa;Next Payment Amount:        ^^^^" x:Name="LeftGroup"/>
            <TextBlock Height="37.627" Style="{StaticResource DefaultImportantBodyText}" 
                       Canvas.Left="436" Canvas.Top="0" Width="200" Text="Amount Past Due:&#xd;&#xa;           ^^" x:Name="RightGroup"/>
        </Canvas>

        <TextBlock Opacity="0.7" RenderTransformOrigin="0.5,0.5" Height="15.265" 
                   Style="{StaticResource MainMenuHeadingDivider}" Canvas.Left="365" Canvas.Top="60.54">
    <Run Text="|                                    |"/>
  </TextBlock>

        <TextBlock Opacity="0.7" RenderTransformOrigin="0.5,0.5" Height="15.265" 
                    Style="{StaticResource MainMenuHeading}" Width="84"
                   Text="Summary" Canvas.Left="225" Canvas.Top="60.54"
             MouseEnter="MenuLink_MouseEnter"
             MouseLeave="MenuLink_MouseLeave">
    <TextBlock.RenderTransform>
      <TransformGroup>
        <ScaleTransform ScaleX="1" ScaleY="1"/>
        <SkewTransform AngleX="0" AngleY="0"/>
        <RotateTransform Angle="0"/>
        <TranslateTransform X="0" Y="0"/>
      </TransformGroup>
    </TextBlock.RenderTransform>
  </TextBlock>

        <TextBlock Opacity="0.7" RenderTransformOrigin="0.5,0.5" Height="15.265" Style="{StaticResource MainMenuHeading}"
                   Text="History" Canvas.Left="425" Canvas.Top="60.54" 
             MouseEnter="MenuLink_MouseEnter"
             MouseLeave="MenuLink_MouseLeave">
    <TextBlock.RenderTransform>
      <TransformGroup>
        <ScaleTransform ScaleX="1" ScaleY="1"/>
        <SkewTransform AngleX="0" AngleY="0"/>
        <RotateTransform Angle="0"/>
        <TranslateTransform X="0" Y="0"/>
      </TransformGroup>
    </TextBlock.RenderTransform>
  </TextBlock>

        <TextBlock Opacity="0.7" RenderTransformOrigin="0.5,0.5" Height="15.265" Style="{StaticResource MainMenuHeading}"
                   Text="Compare Mortgages"  Canvas.Left="600" Canvas.Top="60.54" 
             MouseEnter="MenuLink_MouseEnter"
             MouseLeave="MenuLink_MouseLeave">
    <TextBlock.RenderTransform>
      <TransformGroup>
        <ScaleTransform ScaleX="1" ScaleY="1"/>
        <SkewTransform AngleX="0" AngleY="0"/>
        <RotateTransform Angle="0"/>
        <TranslateTransform X="0" Y="0"/>
      </TransformGroup>
    </TextBlock.RenderTransform>
  </TextBlock>
        <!--End Text areas-->
    </Canvas>

</UserControl>